// packageJ/tagBalance/tagBalanceIndex/tagBalanceIndex.js
const app = getApp();
const skinBehavior = require('../../../utils/themeSkin/skinBehavior');
Page({
  behaviors: [skinBehavior],
  /**
   * 页面的初始数据
   */
  data: {
    navigationBarHeight: '',
    diy_name:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let basic_info = wx.getStorageSync('yz_basic_info');
    let diy_name = basic_info.plugin_setting?.tag_balance?.diy_name;
    this.setData({
      diy_name: diy_name ? diy_name : '充值标签'
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getData();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  toAllUrl(){
    wx.navigateTo({
      url: '/packageJ/tagBalance/tagBalanceDetailed/tagBalanceDetailed',
    })
  },
  toBalance() {
    wx.navigateTo({
      url: '/packageA/member/balance/balance_recharge/balance_recharge?name=balance_rechargeTag',
    })
  },
  toRecord() {
    wx.navigateTo({
      url: '/packageJ/tagBalance/tagBalanceRecord/tagBalanceRecord',
    })
  },
  getData() {
    let urlStr = app.getNetAddresss("plugin.tag-balance.frontend.index.index");
    app._getNetWork({
      url: urlStr,
      success: resdata => {
        let {
          result,
          data,
          msg
        } = resdata.data;
        if (result) {
          this.setData({
            info: data
          })
        } else {
          app.tips(msg);
        }
      }
    })
  }
})